Skip to content

Data sources, random/sequential generators, Equivalence classes#5

Merged
robdmoore merged 7 commits intoTestStack:anonymous-valuesfrom
mwhelan:anonymous-values
Sep 18, 2014
Merged

Data sources, random/sequential generators, Equivalence classes#5
robdmoore merged 7 commits intoTestStack:anonymous-valuesfrom
mwhelan:anonymous-values

Conversation

@mwhelan
Copy link
Copy Markdown
Member

@mwhelan mwhelan commented Sep 17, 2014

Put together some data sources of type string, just to be treated of samples of some ideas for discussion rather than anything in particular. They simply provide a list of strings, then a generator picks an index value to return a particular value from the list. A Random Generator picks an index value at random from 0 to List.Count. This is not guaranteed to be unique, but is reasonably unique. You might get 9 unique values and 1 duplicate out of 10 generations for example. (You would just add a Unique Random Generator if you wanted this functionality). A Sequential Generator returns each value in sequence. By default it will go back to the start of the sequence after it gets to the end of the collection, but if you specify a unique constraint during construction then it will throw an exception if it exceeds the collection.
These data sources can be used independently as Pick data sources, or consumed by Equivalence Classes for Any extensions (see CompanyEquivalenceClass example).
I also experimented with reading in data from a text file which is set as an embedded resource. I got some free sample data online that provides 500 records of people data, such as First/Last Name, City, Address etc. You can get this data for UK/US/Australia/Canada. It is initialized once and then is available during the AppDomain. At the moment, there are 3 example equivalence classes, for Any.FirstName, Any.LastName, and Any.FullName. It would be easy to do Any.Person.FirstName/LastName etc. if the number of data sources became too many...
I did not put XML comments on, but happy to do so if we decide any of these ideas are worth taking further.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test

robdmoore added a commit that referenced this pull request Sep 18, 2014
Data sources, random/sequential generators, Equivalence classes
@robdmoore robdmoore merged commit 029d200 into TestStack:anonymous-values Sep 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants